# -*- coding: utf-8 -*-
# File : network.py
# Author: taoyahui
# Date : 2022/5/19

import networkx as nx
import matplotlib.pyplot as plt
# 1.先创建对象
G = nx.Graph()
# 2.创建节点
G.add_node(1)
G.add_node(2)
G.add_node(3)
G.add_node(4)
G.add_node(5)
# 3.创建边
G.add_edges_from([(1, 2), (2, 3), (3, 4),(4,5),(1,5)])
nx.draw(G)
plt.show()